<?xml version="1.0" encoding="UTF-8"?>
<project name="tfsissuetracker" default="all">
  
  
  <property file="tfsissuetracker.properties"/>
  <!-- Uncomment the following property if no tests compilation is needed -->
  <!-- 
  <property name="skip.tests" value="true"/>
   -->
  
  <!-- Compiler options -->
  
  <property name="compiler.debug" value="on"/>
  <property name="compiler.generate.no.warnings" value="off"/>
  <property name="compiler.args" value=""/>
  <property name="compiler.max.memory" value="128m"/>
  <patternset id="ignored.files">
    <exclude name="**/CVS/**"/>
    <exclude name="**/SCCS/**"/>
    <exclude name="**/RCS/**"/>
    <exclude name="**/rcs/**"/>
    <exclude name="**/.DS_Store/**"/>
    <exclude name="**/.svn/**"/>
    <exclude name="**/.pyc/**"/>
    <exclude name="**/.pyo/**"/>
    <exclude name="**/*.pyc/**"/>
    <exclude name="**/*.pyo/**"/>
    <exclude name="**/.git/**"/>
    <exclude name="**/*.hprof/**"/>
    <exclude name="**/_svn/**"/>
    <exclude name="**/.hg/**"/>
    <exclude name="**/*.lib/**"/>
    <exclude name="**/*~/**"/>
    <exclude name="**/__pycache__/**"/>
    <exclude name="**/.bundle/**"/>
    <exclude name="**/*.rbc/**"/>
  </patternset>
  <patternset id="library.patterns">
    <include name="*.zip"/>
    <include name="*.apk"/>
    <include name="*.war"/>
    <include name="*.egg"/>
    <include name="*.ear"/>
    <include name="*.ane"/>
    <include name="*.swc"/>
    <include name="*.jar"/>
  </patternset>
  <patternset id="compiler.resources">
    <include name="**/?*.properties"/>
    <include name="**/?*.xml"/>
    <include name="**/?*.gif"/>
    <include name="**/?*.png"/>
    <include name="**/?*.jpeg"/>
    <include name="**/?*.jpg"/>
    <include name="**/?*.html"/>
    <include name="**/?*.dtd"/>
    <include name="**/?*.tld"/>
    <include name="**/?*.jsp"/>
    <include name="**/?*.css"/>
    <include name="**/?*.html"/>
    <include name="**/?*.htm"/>
    <include name="**/?*.ftl"/>
    <include name="**/?*.exe"/>
    <include name="**/?*.pdb"/>
    <include name="**/?*.dll"/>
    <include name="**/?*.config"/>
  </patternset>
  
  
  <!-- Project Libraries -->
  
  <path id="library.teamcity_internals.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/server.jar"/>
  </path>
  
  <path id="library.teamcity_open_api_common.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/common-api.jar"/>
  </path>
  
  <path id="library.teamcity_open_api_server.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/server-api.jar"/>
  </path>
  
  <path id="library.teamcity_third-party.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/annotations.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/commons-httpclient-3.1.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/ehcache-1.6.0-patch.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/ehcache-1.6.2.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/jdom.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/openapi.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/spring-webmvc.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/spring.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/util.jar"/>
  </path>
  
  <path id="library.tomcat.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/lib/servlet-api.jar"/>
  </path>
  
  <!-- Modules -->
  
  
  <!-- Module server -->
  
  <dirname property="module.server.basedir" file="${ant.file}"/>
  
  
  
  <property name="compiler.args.server" value="${compiler.args}"/>
  
  <property name="server.output.dir" value="${module.server.basedir}/out/production/server"/>
  <property name="server.testoutput.dir" value="${module.server.basedir}/out/test/server"/>
  
  <path id="server.module.bootclasspath">
    <!-- Paths to be included in compilation bootclasspath -->
  </path>
  
  <path id="server.module.production.classpath">
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_internals.classpath"/>
  </path>
  
  <path id="server.runtime.production.module.classpath">
    <pathelement location="${server.output.dir}"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_internals.classpath"/>
  </path>
  
  <path id="server.module.classpath">
    <pathelement location="${server.output.dir}"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_internals.classpath"/>
  </path>
  
  <path id="server.runtime.module.classpath">
    <pathelement location="${server.testoutput.dir}"/>
    <pathelement location="${server.output.dir}"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_internals.classpath"/>
  </path>
  
  
  <patternset id="excluded.from.module.server">
    <patternset refid="ignored.files"/>
  </patternset>
  
  <patternset id="excluded.from.compilation.server">
    <patternset refid="excluded.from.module.server"/>
  </patternset>
  
  <path id="server.module.sourcepath">
    <dirset dir="${module.server.basedir}">
      <include name="src"/>
      <include name="bin"/>
      <include name="resources"/>
    </dirset>
  </path>
  
  
  <target name="compile.module.server" depends="compile.module.server.production,compile.module.server.tests" description="Compile module server"/>
  
  <target name="compile.module.server.production" description="Compile module server; production classes">
    <mkdir dir="${server.output.dir}"/>
    <javac destdir="${server.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
      <compilerarg line="${compiler.args.server}"/>
      <bootclasspath refid="server.module.bootclasspath"/>
      <classpath refid="server.module.production.classpath"/>
      <src refid="server.module.sourcepath"/>
      <patternset refid="excluded.from.compilation.server"/>
    </javac>
    
    <copy todir="${server.output.dir}">
      <fileset dir="${module.server.basedir}/src">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
      <fileset dir="${module.server.basedir}/resources">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
    </copy>
    <copy todir="${server.output.dir}/bin">
      <fileset dir="${module.server.basedir}/bin">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
    </copy>
  </target>
  
  <target name="compile.module.server.tests" depends="compile.module.server.production" description="compile module server; test classes" unless="skip.tests"/>
  
  <target name="clean.module.server" description="cleanup module">
    <delete dir="${server.output.dir}"/>
    <delete dir="${server.testoutput.dir}"/>
  </target>
  
  <target name="init" description="Build initialization">
    <!-- Perform any build initialization in this target -->
  </target>
  
  <target name="clean" depends="clean.module.server" description="cleanup all"/>
  
  <target name="build.modules" depends="init, clean, compile.module.server" description="build all modules"/>
  
  <target name="all" depends="build.modules" description="build all"/>
</project>